package com.example.peanutsubway.service.impl;

import com.example.peanutsubway.dao.impl.RoleInfoDaoImpl;
import com.example.peanutsubway.entity.Menu;
import com.example.peanutsubway.entity.RoleInfo;
import com.example.peanutsubway.service.RoleInfoService;
import com.example.peanutsubway.util.PageInfo;

import java.sql.Connection;
import java.util.List;

/**
 * @Author：zzt
 * @Version：1.0
 * @Date：2021/10/17-14:21
 * @Since:jdk1.8
 * @Description:
 */
public class RoleInfoServiceImpl implements RoleInfoService {
    private RoleInfoDaoImpl roleInfoDao = new RoleInfoDaoImpl();
    @Override
    public void setConnection(Connection connection) {
        roleInfoDao.setConnection(connection);
    }


    @Override
    public Boolean addRoleInfo(RoleInfo roleInfo) {
        return roleInfoDao.addRoleInfo(roleInfo);
    }

    @Override
    public PageInfo findAllRole(RoleInfo roleInfo, String nowPage, String pageNum) {
        PageInfo pageInfo = new PageInfo(nowPage, pageNum,roleInfoDao.count());
        List<RoleInfo> allRoleInfo = roleInfoDao.findAllRoleInfo(pageInfo);
        pageInfo.setDataList(allRoleInfo);
        return pageInfo;
    }

    @Override
    public Boolean deleteRole(Integer id) {
        return roleInfoDao.deleteRole(id);
    }

    @Override
    public Boolean updateRole(RoleInfo roleInfo) {
        return roleInfoDao.updateRole(roleInfo);
    }
}
